with v8.Class_Object, v8.Class_String, v8.Class_Value, v8.Class_Script;
package v8.Class_Function is
   type Function_T (<>) is new v8.Class_Object.Object with private;
   type Pointer is access all Function_T;
   -- A JavaScript function object (ECMA-262, 15.3).


   function New_Instance
     (this : Function_T
     ) return Pointer;

   function New_Instance
     (this : Function_T;
      args : v8.Class_Value.Value_Array
     ) return Pointer;

   function Call
     (this : in out Function_T;
      recv : v8.Class_Object.Pointer;
      args : v8.Class_Value.Value_Array
     ) return v8.Class_Value.Pointer;

   procedure Set_Name
     (this : in out Function_T;
      name : v8.Class_String.Pointer);

   function Get_Name
     (this : Function_T
     ) return v8.Class_Value.Pointer;
   -- return Handle<Value>

   function Get_Script_Line_Number
     (this : Function_T
     ) return int;
   -- Returns zero based line number of function body and
   -- kLineOffsetNotFound if no information available.

   function Get_Script_Origin
     (this : Function_T
     ) return v8.Class_Script.Pointer;

   function Cast is new Ada.Unchecked_Conversion (v8.Class_Value.Pointer, Pointer);
   -- Convert Value to Function



   kLineOffsetNotFound : aliased constant int;


private
   type Function_T is new v8.Class_Object.Object with null record;


   pragma Import (CPP, Set_Name, "_ZN2v88Function7SetNameENS_6HandleINS_6StringEEE");
   pragma Import (CPP, Get_Name, "_ZNK2v88Function7GetNameEv");
   pragma Import (CPP, Get_Script_Line_Number, "_ZNK2v88Function19GetScriptLineNumberEv");
   pragma Import (CPP, Get_Script_Origin, "_ZNK2v88Function15GetScriptOriginEv");
   pragma Import (CPP, kLineOffsetNotFound, "_ZN2v88Function19kLineOffsetNotFoundE");
end v8.Class_Function;
